package njust.csc.aeapi.entity

/**
 * @Author ZhouHang
 * @Date 24/7/8 周一
 * 研判结果的存储类
 */
class JudgeResult {
    var isScam = false
    var isGamble = false
    var isSex = false

    private val scamReason = mutableListOf<String>()
    private fun addScamReason(reason: String) {
        scamReason.add(reason)
        isScam = true
    }
    fun scamReason(): String {
        return scamReason.joinToString ("\n")
    }

    private val gambleReason = mutableListOf<String>()
    private fun addGambleReason(reason: String) {
        gambleReason.add(reason)
        isGamble = true
    }
    fun gambleReason(): String {
        return gambleReason.joinToString ("\n")
    }

    private val sexReason = mutableListOf<String>()
    private fun addSexReason(reason: String) {
        sexReason.add(reason)
        isSex = true
    }
    fun sexReason(): String {
        return sexReason.joinToString ("\n")
    }

    private val normalReason = mutableListOf<String>()
    private fun addNormalReason(reason: String) {
        normalReason.add(reason)
    }
    fun normalReason(): String {
        return normalReason.joinToString ("\n")
    }

    fun addReason(reason: String, type: String) {
        when (type) {
            "gamble" -> addGambleReason(reason)
            "sex" -> addSexReason(reason)
            "scam" -> addScamReason(reason)
            "normal" -> addNormalReason(reason)
        }
    }

    override fun toString(): String {
        val sb = StringBuilder()
        if (isSex) {
            sb.append(sexReason()).append(" ")
        }
        if (isGamble) {
            sb.append(gambleReason()).append(" ")
        }
        if (isSex) {
            sb.append(sexReason()).append(" ")
        }
        return sb.toString()
    }
}
